﻿using System;
using System.Windows.Forms;
using BackupLibrary;

namespace BackupJob
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //String path = System.Reflection.Assembly.GetExecutingAssembly().Location;
            //path = System.IO.Path.GetDirectoryName(path);
            //MessageBox.Show(path);

            Settings.Get.EmailAdress = "yasin.ozbey@gmail.com";
            Settings.Get.Message = "yedek gitti";
            Settings.Get.WinrarPath = @"C:\Program Files\WinRAR\Rar.exe";


            Jobs jobs = new Jobs();
            jobs.AllTask.Add(new Job()
            {
                Database = "ESMER",
                Folder = "C:\\Cambridge",
                Security = Job.AutenticationTypes.Sql,
                Type = Job.BackupTypes.Ftp,
                StartingDate = DateTime.Now.AddMinutes(5),
                FtpServer = "192.168.2.25",
                FtpPassword = "hero1981",
                FtpFolder = "/FTP/yasin/",
                FtpUser = "yasin",
                Server = ".",
                UserName = "sa",
                Password = "",
                doCompress = true,
                FtpPort = 21
            });

            BackupProcess.BackupNow(jobs.AllTask[0]);


            //Serialization sr = new Serialization();
            //string xml = sr.SerializeJob(jobs);
            //Jobs jb = sr.DeserializeJob(xml);


            Settings.Get.SaveAll();

        }
    }
}
